{extend name='admin@public/content'}

{block name="button"}

{/block}

{block name="content"}
<!-- 表单搜索 开始 -->
<form id="form_search" class="layui-form layui-form-pane form-search" action="{:request()->url()}"
      onsubmit="return false" method="get">

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">抽奖类型</label>
        <div class="layui-input-inline">
            <select name="type" class="layui-select">
                <option value="">- 全部 -</option>
                <!--{foreach [1=>'高级抽奖',2=>'普通抽奖'] as $key=>$type}-->
                <!--{if $Think.get.type eq $key.''}-->
                <option selected value="{$key}">- {$type} -</option>
                <!--{else}-->
                <option value="{$key}">- {$type} -</option>
                <!--{/if}-->
                <!--{/foreach}-->
            </select>
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">奖 品</label>
        <div class="layui-input-inline">
            <select name="tag" class="layui-select" lay-search="true">
                <option value="">- 奖品标签 -</option>
                <!--{foreach $tags as $key=>$tag}-->
                <!--{if $Think.get.tag eq $tag.lottery_pool_id}-->
                <option selected value="{$tag.lottery_pool_id}">{$tag.good_name}</option>
                <!--{else}-->
                <option value="{$tag.lottery_pool_id}">{$tag.good_name}</option>
                <!--{/if}-->
                <!--{/foreach}-->
            </select>
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">中奖时间</label>
        <div class="layui-input-inline">
            <input name="addtime" id='addtime' value="{$Think.get.addtime|default=''}" placeholder="中奖时间"
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <input type="hidden" id="is_report" name="is_report" value="0">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
        <a id="do_report" href="javascript:void (0)" data-href_url="{:request()->url()}"
           class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 导 出</a>
    </div>

</form>
<!-- 表单搜索 结束 -->

<form onsubmit="return false;" data-auto="true" method="post">
    <!--{if empty($list)}-->
    <p class="help-block text-center well">没 有 记 录 哦！</p>
    <!--{else}-->
    <input type="hidden" value="resort" name="action">
    <table class="layui-table" lay-skin="line">
        <thead>
        <tr>
            <th class='text-left'>
                中奖ID
            </th>
            <th class='text-left'>奖品</th>
            <th class='text-left'>抽奖类型</th>
            <th class='text-left'>中奖人</th>
            <th class='text-left'>中奖CDkey</th>
            <th class='text-left'>中奖提示信息</th>
            <th class='text-left'>中奖跳转的链接</th>
            <th class='text-left'>中奖时间</th>
            <th></th>
        </tr>
        </thead>
        <tbody>
        {foreach $list as $key=>$vo}
        <tr>
            <td class='text-left nowrap'>
                {$vo.id}
            </td>
            <td class='text-left nowrap'>
                <img data-tips-image class="headimg" src="{$vo.original_img}"/>
                {$vo.goods_name|default=''}
            </td>
            <td class='text-left nowrap'> {$vo.type==1?'高级抽奖':($vo.type==0?'普通抽奖':'未知')}</td>
            <td class='text-left nowrap'>{$vo.nickname|default='无'}</td>

            <td class='text-left nowrap'>{$vo.cdkey|default=''}</td>
            <td class='text-left nowrap'>{$vo.copywriter2|default=''}</td>
            <td class='text-left nowrap'>{$vo.href|default=''}</td>
            <td class='text-left nowrap'>{$vo.addtime|date="Y-m-d H:i:s"}</td>

            <td class="text-center nowrap">

            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {if isset($page)}<p>{$page|raw}</p>{/if}
    <!--{/if}-->
</form>
{/block}

{block name="script"}
<!--表单初始化-->
<script>
    window.laydate.render({range: true, elem: '#addtime'});
    window.form.render();

    $("#do_report").on("click", function () {
        var href_url = $(this).data("href_url");
        var type = $("select[name='type']").val();
        var tag = $("select[name='tag']").val();
        var addtime = $("input[name='addtime']").val();
        href_url = href_url + "&is_report=1&type="+type+"&tag="+tag+"&addtime="+addtime;
        return window.location.href = href_url;
    })
</script>
<style>
    .headimg {
        width: 25px;
        height: 25px;
        border-radius: 50%;
        margin-right: 10px;
    }

    .add-tag {
        font-size: 12px;
        font-weight: 400;
        border-radius: 50%;
        color: #333;
        background: #eee;
        border: 1px solid #ddd;
    }

    .add-tag:hover {
        color: #000 !important;
        border: 1px solid #ccc;
    }

</style>
{/block}
